package com.example.mideaoem.utils;

import java.util.HashMap;
import java.util.Map;



public class TemperatureUtil{

	 static Map<String, String> temperature=new HashMap<String, String>();
	 static Map<String, String> temperature2=new HashMap<String, String>();
	 static Map<String, String> shushui_temperature_S_H=new HashMap<String, String>();
	 static Map<String, String> shushui_temperature_H_S=new HashMap<String, String>();
	 static Map<Integer, Integer> innerTemp = new HashMap<Integer, Integer>();
	 
	static {
		temperature.put("17.0", "62");
		temperature.put("17.5", "63");
		temperature.put("18.0", "64");
		temperature.put("18.5", "65");
		temperature.put("19.0", "66");
		temperature.put("19.5", "67");
		temperature.put("20.0", "68");
		temperature.put("20.5", "69");
		temperature.put("21.0", "70");
		temperature.put("21.5", "71");
		temperature.put("22.0", "72");
		temperature.put("22.5", "73");
		temperature.put("23.0", "73");
		temperature.put("23.5", "74");
		temperature.put("24.0", "75");
		temperature.put("24.5", "76");
		temperature.put("25.0", "77");
		temperature.put("25.5", "78");
		temperature.put("26.0", "79");
		temperature.put("26.5", "80");
		temperature.put("27.0", "81");
		temperature.put("27.5", "82");
		temperature.put("28.0", "82");
		temperature.put("28.5", "83");
		temperature.put("29.0", "84");
		temperature.put("29.5", "85");
		temperature.put("30.0", "86");
		temperature.put("30.5", "86");

		temperature2.put("62.0", "17.0");
		temperature2.put("63.0", "17.5");
		temperature2.put("64.0", "18.0");
		temperature2.put("65.0", "18.5");
		temperature2.put("66.0", "19.0");
		temperature2.put("67.0", "19.5");
		temperature2.put("68.0", "20.0");
		temperature2.put("69.0", "20.5");
		temperature2.put("70.0", "21.0");
		temperature2.put("71.0", "21.5");
		temperature2.put("72.0", "22.0");
		temperature2.put("73.0", "22.5");
		temperature2.put("73.0", "23.0");
		temperature2.put("74.0", "23.5");
		temperature2.put("75.0", "24.0");
		temperature2.put("76.0", "24.5");
		temperature2.put("77.0", "25.0");
		temperature2.put("78.0", "25.5");
		temperature2.put("79.0", "26.0");
		temperature2.put("80.0", "26.5");
		temperature2.put("81.0", "27.0");
		temperature2.put("82.0", "27.5");
		temperature2.put("82.0", "28.0");
		temperature2.put("83.0", "28.5");
		temperature2.put("84.0", "29.0");
		temperature2.put("85.0", "29.5");
		temperature2.put("86.0", "30.0");

		shushui_temperature_S_H.put("16", "60");
		shushui_temperature_S_H.put("17", "62");
		shushui_temperature_S_H.put("18", "64");
		shushui_temperature_S_H.put("19", "66");
		shushui_temperature_S_H.put("20", "68");
		shushui_temperature_S_H.put("21", "70");
		shushui_temperature_S_H.put("22", "72");
		shushui_temperature_S_H.put("23", "73");
		shushui_temperature_S_H.put("24", "75");
		shushui_temperature_S_H.put("25", "77");
		shushui_temperature_S_H.put("26", "79");
		shushui_temperature_S_H.put("27", "81");
		shushui_temperature_S_H.put("28", "82");
		shushui_temperature_S_H.put("29", "84");
		shushui_temperature_S_H.put("30", "86");
		shushui_temperature_S_H.put("31", "88");

		shushui_temperature_H_S.put("60", "16");
		shushui_temperature_H_S.put("62", "17");
		shushui_temperature_H_S.put("64", "18");
		shushui_temperature_H_S.put("66", "19");
		shushui_temperature_H_S.put("68", "20");
		shushui_temperature_H_S.put("70", "21");
		shushui_temperature_H_S.put("72", "22");
		shushui_temperature_H_S.put("73", "23");
		shushui_temperature_H_S.put("75", "24");
		shushui_temperature_H_S.put("77", "25");
		shushui_temperature_H_S.put("79", "26");
		shushui_temperature_H_S.put("81", "27");
		shushui_temperature_H_S.put("82", "28");
		shushui_temperature_H_S.put("84", "29");
		shushui_temperature_H_S.put("86", "30");
		shushui_temperature_H_S.put("88", "31");
		
	}
	
	
	 
	/**
	 * 摄氏度转华氏度
	 * @param temperature
	 * @return
	 */
    public static String centigrade2Fahrenheit(String currTemp) {
	    	String s =  (String)temperature.get(currTemp);
	    	if(s == null){
	   		return currTemp;
	    	}else{
	    		return s;
	    	}
    }
    
    public static int centigrade2Fahrenheit(int currTemp){
		return currTemp;
    }
    
    /**
     * 华氏转摄氏度
     * @param currTemp
     * @return
     */
	public static String Fahrenheit2centigrade(String currTemp) {
		String s = (String)temperature2.get(currTemp);
		if (s == null) {
			return currTemp;
		} else {
			return s;
		}
	}
	
}
